n = int(input())
nums = [int(x) for x in input().split(" ")]
l = 0
r = n - 1
while l < r:
    if nums[l] % 2 == 1 and nums[r] % 2 == 0:
        nums[l], nums[r] = nums[r], nums[l]
    elif nums[l] % 2 == 0 and nums[r] % 2 == 1:
        l += 1
        r -= 1
    elif nums[l] % 2 == 1 and nums[r] % 2 == 1:
        r -= 1
    else:
        l += 1
for num in nums:
    print(num, end=" ")